ASP.NET 2.0 Modal Dialog Window & Master Page

ASP.NET 2.0 Modal Dialog Window & Master Page

am 24.01.2008 17:15:55 von ABHIJIT B

Kindly help me in following

1.In my module, I am using two pages Parent(ManageUser) and Child()
page.

Parent window has textbox and button to open Child window
Child page opens as dialog window as you click on button in Parent
page using JavaScript showwmodaldialog().
Child window has textbox and button to return value back to parent
page.

I am new to ASP.NET 2.0.I tried doing following,

Aftrer entering any value in textbox of Child page and clicking Close
button value can be seen in Parent page textbox.

-----< I am doing this changes in CodeBehind files > -----

Now, I am trying to use Hidden Control using normal HTML



hdvRowID.Value = "AB";

I am not able to access value in JavaScript code so it is giving error
while
taking value.

Books.book_id = document.getElementById('hdvRowID').value;

------------------------------------------------------------ ------------------------------------------------------------ ---

< Parent page code : >

if (!ClientScript.IsStartupScriptRegistered("ManageUser"))
{

ClientScript.RegisterStartupScript(this.GetType(), "ManageUser",
" ");
}
------------------------------------------------------------ ------------------------------------------------------------ ---
< Child page code : >

ClientScript.RegisterHiddenField("txthidLoginID1", "XYZ");

btnSUOK1.Attributes.Add("onclick", "return
ReturnBook()");

if (!
ClientScript.IsStartupScriptRegistered("SearchUsers"))
{
ClientScript.RegisterStartupScript(this.GetType(),
"SearchUsers",
" ");
}

2. In our application we are using only one Master page having label
control

All pages uses Master page



runat="server">


I am trying to change Master page label lblHeader text to Manage User
using following code,I am getting error.

A.

Label lblMasterHeader = (Label)Master.FindControl("lblHeader");
lblMasterHeader.Text = "DataChecker - Manage Users";

B.

Label lblMasterHeader =
(Label)Master.FindControl("ContentPlaceHolder1").FindControl ("lblHeader");
lblMasterHeader.Text = "DataChecker - Manage Users";

C.

string selectedValue =
Request.Form[this.FindControl("ContentPlaceHolder1").FindCon trol("lblHeader").UniqueID];
lblMasterHeader.Text = "DataChecker - Manage Users";

RE: ASP.NET 2.0 Modal Dialog Window & Master Page

am 24.01.2008 17:49:00 von brucebarker

try:

Books.book_id = document.getElementById('<%=hdvRowID.ClientID%>').value;

also you should move away from a modaldialog solution. this is an IE only
feature and may be droped as IE becomes more w3c compliant. most site uses a
floating div to do this feature. the ajaxtoolkit also has a solution.


-- bruce (sqlwork.com)


"ABHIJIT B" wrote:

>
> Kindly help me in following
>
> 1.In my module, I am using two pages Parent(ManageUser) and Child()
> page.
>
> Parent window has textbox and button to open Child window
> Child page opens as dialog window as you click on button in Parent
> page using JavaScript showwmodaldialog().
> Child window has textbox and button to return value back to parent
> page.
>
> I am new to ASP.NET 2.0.I tried doing following,
>
> Aftrer entering any value in textbox of Child page and clicking Close
> button value can be seen in Parent page textbox.
>
> -----< I am doing this changes in CodeBehind files > -----
>
> Now, I am trying to use Hidden Control using normal HTML
>
>
>
> hdvRowID.Value = "AB";
>
> I am not able to access value in JavaScript code so it is giving error
> while
> taking value.
>
> Books.book_id = document.getElementById('hdvRowID').value;
>
> ------------------------------------------------------------ ------------------------------------------------------------ ---
>
> < Parent page code : >
>
> if (!ClientScript.IsStartupScriptRegistered("ManageUser"))
> {
>
> ClientScript.RegisterStartupScript(this.GetType(), "ManageUser",
> " ");
> }
> ------------------------------------------------------------ ------------------------------------------------------------ ---
> < Child page code : >
>
> ClientScript.RegisterHiddenField("txthidLoginID1", "XYZ");
>
> btnSUOK1.Attributes.Add("onclick", "return
> ReturnBook()");
>
> if (!
> ClientScript.IsStartupScriptRegistered("SearchUsers"))
> {
> ClientScript.RegisterStartupScript(this.GetType(),
> "SearchUsers",
> " ");
> }
>
> 2. In our application we are using only one Master page having label
> control
>
> All pages uses Master page
>
>
>
> > runat="server">
>

>
> I am trying to change Master page label lblHeader text to Manage User
> using following code,I am getting error.
>
> A.
>
> Label lblMasterHeader = (Label)Master.FindControl("lblHeader");
> lblMasterHeader.Text = "DataChecker - Manage Users";
>
> B.
>
> Label lblMasterHeader =
> (Label)Master.FindControl("ContentPlaceHolder1").FindControl ("lblHeader");
> lblMasterHeader.Text = "DataChecker - Manage Users";
>
> C.
>
> string selectedValue =
> Request.Form[this.FindControl("ContentPlaceHolder1").FindCon trol("lblHeader").UniqueID];
> lblMasterHeader.Text = "DataChecker - Manage Users";
>
>
>
>
>

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 24.01.2008 18:24:59 von mark

"bruce barker" wrote in message
news:0A7FA7D0-195D-4AA8-9AEE-234D8E087379@microsoft.com...

> also you should move away from a modaldialog solution.

Definitely.

> this is an IE only feature

IE and, curiously, Safari for Mac... :-)

> and may be droped as IE becomes more w3c compliant. most site uses a
> floating div to do this feature. the ajaxtoolkit also has a solution.

Yes indeed - extremely simple to set up...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 30.01.2008 18:10:32 von ABHIJIT B

Thanks Bruce.

This is client requirement.Can you let me know How can I change Label
text of Master page in Content page

Thanks in advance.

On Jan 24, 11:49=A0am, bruce barker
wrote:
> try:
>
> Books.book_id =3D document.getElementById('<%=3DhdvRowID.ClientID%>').valu=
e;
>
> also you should move away from a modaldialog solution. this is an IE only
> feature and may be droped as IE becomes more w3c compliant. most site uses=
a
> floating div to do this feature. the ajaxtoolkit also has a solution.
>
> -- bruce (sqlwork.com)
>
>
>
> "ABHIJIT B" wrote:
>
> > Kindly help me in following
>
> > 1.In my module, I am using two pages Parent(ManageUser) and Child()
> > page.
>
> > Parentwindowhas textbox and button to open Childwindow
> > Child page opens asdialogwindowas you click on button in Parent
> > page using JavaScript showwmodaldialog().
> > Childwindowhas textbox and button to return value back to parent
> > page.
>
> > I am new to ASP.NET 2.0.I tried doing following,
>
> > Aftrer entering any value in textbox of Child page and clicking Close
> > button value can be seen in Parent page textbox.
>
> > -----< I am doing this changes in CodeBehind files > -----
>
> > Now, I am trying to use Hidden Control using normal HTML
>
> > D"/>
>
> > hdvRowID.Value =3D "AB";
>
> > I am not able to access value in JavaScript code so it is giving error
> > while
> > taking value.
>
> > Books.book_id =3D document.getElementById('hdvRowID').value;
>
> > ------------------------------------------------------------ ------------=
---=AD------------------------------------------------
>
> > < Parent page code : >
>
> > if (!ClientScript.IsStartupScriptRegistered("ManageUser"))
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
>
> > ClientScript.RegisterStartupScript(this.GetType(), "ManageUser",
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " ");
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> > ------------------------------------------------------------ ------------=
---=AD------------------------------------------------
> > < Child page code : >
>
> > ClientScript.RegisterHiddenField("txthidLoginID1", "XYZ");
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 btnSUOK1.Attributes.Add("onclick", "retu=
rn
> > ReturnBook()");
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!
> > ClientScript.IsStartupScriptRegistered("SearchUsers"))
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ClientScript.RegisterStartupScri=
pt(this.GetType(),
> > "SearchUsers",
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " ");
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>
> > 2. In our application we are using only one Master page having label
> > control
>
> > All pages uses Master page
>
> >
>
> > > > runat=3D"server">
> >

>
> > I am trying to change Master page label lblHeader text to Manage User
> > using following code,I am getting error.
>
> > A.
>
> > Label lblMasterHeader =3D (Label)Master.FindControl("lblHeader");
> > lblMasterHeader.Text =3D "DataChecker - Manage Users";
>
> > B.
>
> > Label lblMasterHeader =3D
> > (Label)Master.FindControl("ContentPlaceHolder1").FindControl ("lblHeader"=
);
> > lblMasterHeader.Text =3D "DataChecker - Manage Users";
>
> > C.
>
> > string selectedValue =3D
> > Request.Form[this.FindControl("ContentPlaceHolder1").FindCon trol("lblHea=
der=AD").UniqueID];
> > lblMasterHeader.Text =3D "DataChecker - Manage Users";- Hide quoted text=
-
>
> - Show quoted text -

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 30.01.2008 19:00:16 von mark

"ABHIJIT B" wrote in message
news:84886972-1afc-4e20-95cc-3899c6da7620@f10g2000hsf.google groups.com...

> Can you let me know how can I change Label
> text of Master page in Content page

You would typically create a property on the MasterPage and set it from the
content page.

Alternatively, you might just be able to do:

((Label)Master.FindControl("MyLabel")).Text = "Hello";

depending on how your MasterPage is constructed, though I would personally
favour the property method...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 31.01.2008 18:26:32 von ABHIJIT B

Thanks Mark

Can you suggest mistake I am making in below code,

------------------------------------------------------------ ----------------=
------------------------------------------------------------ -
Master page code :

<%@ Master Language=3D"C#" AutoEventWireup=3D"true"
CodeFile=3D"DC.master.cs" Inherits=3D"MasterPage" %>

www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



DC Home
/
>
rel=3D"stylesheet" />









cellspacing=3D"0" height=3D"51px" width=3D"100%"
border=3D"0">




3D"DC<br Site logo" src=3D"DCImages/DC.gif"/> id=3D"lblHeader" class=3D"ApplicationLabelStyle" style=3D"font-
weight:normal" >DC Application








CssClass=3D"CopyrightLabelStyle"
Text=3D"Copyright 2000-2008 Nielsen. All Rights
Reserved">





------------------------------------------------------------ ------------
Content page code :

protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
/********* Setting Label ********/

Label lblMasterHeader =3D
(Label)Master.FindControl("lblHeader");
lblMasterHeader.Text =3D "DC - Users";

//ContentPlaceHolder content;
//content =3D
(ContentPlaceHolder)Page.Master.FindControl("lblHeader");

//((Label)Master.FindControl("lblHeader")).Text =3D
"Hello";


------------------------------------------------------------ ------------

On Jan 30, 1:00=A0pm, "Mark Rae [MVP]" wrote:
> "ABHIJIT B" wrote in message
>
> news:84886972-1afc-4e20-95cc-3899c6da7620@f10g2000hsf.google groups.com...
>
> > Can you let me know how can I change Label
> > text of Master page in Content page
>
> You would typically create a property on the MasterPage and set it from th=
e
> content page.
>
> Alternatively, you might just be able to do:
>
> ((Label)Master.FindControl("MyLabel")).Text =3D "Hello";
>
> depending on how your MasterPage is constructed, though I would personally=

> favour the property method...
>
> --
> Mark RaeASP.NETMVPhttp://www.markrae.net

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 31.01.2008 19:55:45 von mark

"ABHIJIT B" wrote in message
news:c5788987-0ba3-4f10-880c-4557897d23e3@m34g2000hsf.google groups.com...
Thanks Mark

> Can you suggest mistake I am making in below code,

I certainly can...

>

That's an HTMLControl, not a WebControl, so it won't run server-side. Change
it to an WebControl, or add runat="server"...

> Label lblMasterHeader = (Label)Master.FindControl("lblHeader");

That will only work if you change the

Re: ASP.NET 2.0 Modal Dialog Window & Master Page

am 31.01.2008 21:02:30 von ABHIJIT B

Hi Mark,

Thanks Mark for helping me out.
Take Care

Abhijit B

On Jan 31, 1:55=A0pm, "Mark Rae [MVP]" wrote:
> "ABHIJIT B" wrote in message
>
> news:c5788987-0ba3-4f10-880c-4557897d23e3@m34g2000hsf.google groups.com...
> Thanks Mark
>
> > Can you suggest mistake I am making in below code,
>
> I certainly can...
>
> >
>
> That's an HTMLControl, not a WebControl, so it won't run server-side. Chan=
ge
> it to an WebControl, or add runat=3D"server"...
>
> > Label lblMasterHeader =3D (Label)Master.FindControl("lblHeader");
>
> That will only work if you change the